//
//  NiceImgCollectionViewCell.m
//  RoadLine
//
//  Created by dllo on 15/4/21.
//  Copyright (c) 2015年 RedFireNoodles. All rights reserved.
//

#import "NiceImgCollectionViewCell.h"
#import "NightManager.h"

// 定义宏
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height




@implementation NiceImgCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    
    if (self) {
        self.view = [[UIView alloc] initWithFrame:CGRectMake(5, 5, WIDTH, WIDTH)];
        [self.contentView addSubview:self.view];
        [_view release];
        self.view.backgroundColor = [UIColor whiteColor];
        self.view.layer.cornerRadius = 8;
        self.myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, WIDTH)];
        self.myImageView.layer.cornerRadius = 8;
        self.myImageView.contentMode = UIViewContentModeScaleAspectFill;
        self.myImageView.autoresizesSubviews = YES;
        self.myImageView.clipsToBounds = YES;
        [self.view addSubview:self.myImageView];
        [_myImageView release];
        
        UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, WIDTH - WIDTH/4, WIDTH, WIDTH/4)];
        [self.view addSubview:bgView];
        [bgView release];
        bgView.backgroundColor = [UIColor whiteColor];
        bgView.alpha = 0.7;
        bgView.layer.cornerRadius = 8;
        self.myLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/6 - 10, 0, WIDTH - 20, WIDTH/4)];
        self.myLabel.backgroundColor = [UIColor clearColor];
        [bgView addSubview:self.myLabel];
        [_myLabel release];
        self.myLabel.textColor = [UIColor blackColor];
        self.myLabel.font = [UIFont systemFontOfSize:12];
        self.contentView.backgroundColor = [UIColor colorWithRed:250/255.0 green:245/255.0 blue:232/255.0 alpha:1];
        
        if ([Singleton shareSingleton].isNight) {
            [[Singleton shareSingleton] loadNightModeInfoFormDisk];
        }

    }
    return self;

}

- (void)setLightDayModel {
    
    self.contentView.backgroundColor = [UIColor colorWithRed:250/255.0 green:245/255.0 blue:232/255.0 alpha:1];
    self.myLabel.textColor = [UIColor blackColor];
    [NightManager setBackgroundColorWithView:self.view];
    
}

- (void)setNightDayModel {
    self.contentView.backgroundColor = [UIColor blackColor];
    self.myLabel.textColor = [UIColor blackColor];
    [NightManager setBackgroundColorWithView:self.view];
}

//-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
//    [self.delegate clickThisCell:self.myImageView];
//}

@end
